package com.mysteel.product.web;

import com.mysteel.product.service.SkuInfoService;
import com.mysteel.product.vo.web.SkuItemVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;

import java.util.concurrent.ExecutionException;

/**
 * ProjectName: mail
 * ClassName: ItemController
 * Description:
 * date: 2021/02/07/007 15:36
 *
 * @author xiaochao
 */
@Controller
public class ItemController {

    @Autowired
    private SkuInfoService skuInfoService;

    @GetMapping("/{skuId}.html")
    public String skuItem(@PathVariable("skuId") Long skuId, Model model) throws ExecutionException, InterruptedException {

        SkuItemVo itemVo = skuInfoService.item(skuId);
        model.addAttribute("item",itemVo);
        return "item";
    }
}
